dynamic class net.produxion.utils.XML2Object
{
    var _result;
    var _xml;

    function XML2Object()
    {
        this._result = new Object();
    }

    static function deserialize(xml)
    {
        net.produxion.utils.XML2Object.xml2object = new net.produxion.utils.XML2Object();
        net.produxion.utils.XML2Object.xml2object.__set__xml(xml);
        return net.produxion.utils.XML2Object.xml2object.nodesToProperties();
    }

    function get xml()
    {
        return this._xml;
    }

    function set xml(xml)
    {
        this._xml = xml;
    }

    function nodesToProperties(parent, path, name, position)
    {
        var __reg7 = undefined;
        var __reg2 = undefined;
        path == undefined ? (path = this._result) : (path = path[name]);
        if (parent == undefined) 
        {
            parent = XMLNode(this._xml);
        }
        if (parent.hasChildNodes()) 
        {
            __reg7 = parent.childNodes;
            if (position != undefined) 
            {
                path = path[position];
            }
            while (__reg7.length > 0) 
            {
                __reg2 = XMLNode(__reg7.shift());
                if (__reg2.nodeName != undefined) 
                {
                    var __reg4 = new Object();
                    __reg4.attributes = __reg2.attributes;
                    __reg4.data = this.sanitizeLineBreaks(__reg2.firstChild.nodeValue);
                    if (path[__reg2.nodeName] == undefined) 
                    {
                        path[__reg2.nodeName] = __reg4;
                        position = undefined;
                    }
                    else 
                    {
                        if (path[__reg2.nodeName].__proto__ == Array.prototype) 
                        {
                            path[__reg2.nodeName].push(__reg4);
                        }
                        else 
                        {
                            var __reg6 = path[__reg2.nodeName];
                            delete path[__reg2.nodeName];
                            path[__reg2.nodeName] = new Array();
                            path[__reg2.nodeName].push(__reg6);
                            path[__reg2.nodeName].push(__reg4);
                        }
                        position = path[__reg2.nodeName].length - 1;
                    }
                    name = __reg2.nodeName;
                }
                if (__reg2.hasChildNodes()) 
                {
                    this.nodesToProperties(__reg2, path, name, position);
                }
            }
        }
        return this._result;
    }

    function sanitizeLineBreaks(raw)
    {
        if (raw.indexOf("\r\n") > -1) 
        {
            return raw.split("\r\n").join("\n");
        }
        return raw;
    }

}
